<template>
	<view class="content">
		<view class="hh">
			<view class=" center flexbetween"  @click="selectcity(0)">
				<view class="flexleft">
					<view class="express">发</view>
					<view class="select">{{startcitydata.city || "始发地"}}</view>
				</view>
				<view class="right_icon"></view>
			</view>
		</view>
		<view class="header flexbetween"  @click="selectcity(1)">
			<view class="flexleft">
				<view class="go">到</view>
				<view class="select">{{endcitydata.city || "目的地"}}</view>
			</view>
			<view class="right_icon"></view>
		</view>
		<view class="query" @click="check">立即查询</view>
		<pickercity :messageInfo="{pickerdzshow:pickerdzshow}" @surecity="surecity"></pickercity>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 城市选择器开始
				pickerdzshow: false, //城市选择器
				startcitydata: {
					provence: "",
					provenceid: "",
					city: "",
					cityid: ""
				},
				endcitydata: {
					provence: "",
					provenceid: "",
					city: "",
					cityid: ""
				},
				currenttype: "", //0始发地，1结束地
				// 城市选择器结束
			}
		},
		onLoad(options) {
			let data = JSON.parse(decodeURIComponent(options.msg));
			this.startcitydata = data.startcitydata
			this.endcitydata = data.endcitydata
		},
		methods: {
			// 城市选择器开始
			surecity(e) {
				this.pickerdzshow = false
				if (this.currenttype == 0) {
					this.startcitydata = e
				} else if (this.currenttype == 1) {
					this.endcitydata = e
				}
			},
			selectcity(value) {
				this.currenttype = value
				this.pickerdzshow = true
			},
			// 城市选择器结束
			check() {
				let data = {
					startcitydata:this.startcitydata,
					endcitydata:this.endcitydata,
				}
				uni.navigateTo({
					url: '/pages/index/zhuanxianchaxun?msg=' + encodeURIComponent(JSON.stringify(data))
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		background-color: #fafafa;
		min-height: 100vh;
		overflow: hidden;
		padding: 0rpx 30rpx;
	}

	.center {
		margin: 30rpx 0rpx 0rpx 0rpx;
		padding: 37rpx 30rpx 37rpx 30rpx;
		border: 30rpx solid #fff;
	}

	.header {
		padding: 37rpx 30rpx 37rpx 30rpx;
		border: 30rpx solid #fff;
	}

	.express {
		background-color: RGBA(34, 141, 255, 1);
		padding: 3rpx 8rpx;
		font-size: 24rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		border-radius: 9rpx 9rpx 9rpx 9rpx;
		margin-right: 18rpx;
	}

	.select {
		font-size: 34rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #000000;
	}

	.go {
		background-color: RGBA(243, 101, 32, 1);
		padding: 3rpx 8rpx;
		font-size: 24rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		border-radius: 9rpx 9rpx 9rpx 9rpx;
		margin-right: 18rpx;
	}

	.hh {
		border-bottom: 1rpx RGBA(247, 247, 247, 1) solid;
	}

	.query {
		background-color: #3298fe;
		padding: 20rpx 285rpx 20rpx 285rpx;
		position: fixed;
		bottom: 54rpx;
		border-radius: 69rpx 69rpx 69rpx 69rpx;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
	}
</style>
